Skip to content

Spec 028: A host's merged variables, and the file that sets each - #622

Open
shipmill-romamo[bot] wants to merge 1 commit into
mainfrom
spec/028-get-host-variables
Open

shipmill-romamo[bot] wants to merge 1 commit into
mainfrom
spec/028-get-host-variables

Conversation

@shipmill-romamo

@shipmill-romamo shipmill-romamo Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Spec for #620

Plan

  • Serves: G-4
  • Files: docs/specs/028-get-host-variables.md
  • Order: the spec alone, with status: approved; its build issues are filed under the feature issue once it merges
  • Proof: specs.py check passes; each acceptance criterion names the exit code, output or file a test checks
  • Tests changed: none

cloudfall get host <name> on a team's Ansible repository answers the host's merged variables and, for each, the file and precedence level that set the winning value, plus the lower files it overrides. It is item W-4 of the accepted plan #188 for G-4 and closes the get host part of the roadmap's M16 exit. Read-only; writes nothing; vaulted values are never printed.

Decisions for you

None of these departs from a D-n rule. Each adds a new command and output; no existing flag, format, default or stored state changes for existing users.

  1. How the file that wins is found

    • Recommended: ansible-core gives the merged values (in process, with the existing ansible-inventory fallback); Cloudfall walks the files in Ansible's precedence order to name the winner, and checks that file's value equals the merged one. When it doesn't (a custom vars plugin, hash_behaviour = merge, a value a dynamic plugin computes), the variable says "unknown file" instead of guessing
    • Read the source position ansible-core 2.19+ attaches to every loaded value (its data tagging). Exact, with line numbers, but it is an internal API with no fallback through ansible-inventory
  2. How vaulted values are shown

    • Recommended: replaced by {"vaulted": true} in place (top level or nested), with "vaulted": true on the variable; no hash
    • Show a sha256 of the decrypted value, as the secrets guide does for rendered environment files. Lets an agent see a rotation, but hashes a secret Cloudfall did not write
  3. A file Ansible Vault encrypts whole

    • Recommended: open it with the vault password Ansible itself would use in that repository (vault_password_file in ansible.cfg or the ANSIBLE_VAULT_* variables), only to learn its variable names and precedence; never prompt. Without one, refuse with ansible_vault_locked, naming the file and the setting
    • Never decrypt: answer anyway, list the file as unreadable and mark the answer incomplete. No password on the machine, but every variable the file might set is then unknown
  4. Plain (unvaulted) secrets

    • Recommended: redact only Ansible's own connection secrets (ansible_password, ansible_become_password and the like) when they are not vaulted; print every other plain value as the file holds it, since it is plain text in the repository the agent can already read
    • Also redact any variable whose name looks secret (*password*, *token*, *secret*, *_key). Safer, but a guess that hides harmless values and misses oddly named ones
  5. Output shape

    • Recommended: data.variables as a map from variable name to {value, file, level, group?, overridden[]}, so an agent reads variables.nginx_workers.file directly
    • A list of entries sorted by name, each with name. Stable order, but every lookup is a search
  6. How the repository is located, and which group_vars count

    • Recommended: --repository (default: the current directory) and --inventory (default: what its ansible.cfg names), like mcp serve --repository; the repository is the playbook directory, so group_vars beside the playbooks count as they do in a real run
    • --inventory only, like inventory show, reading only the group_vars beside the inventory. Simpler, but wrong for the common layout with inventory/hosts.ini and group_vars/ at the root
  7. On a Cloudfall project

    • Recommended: refuse with fleet_inventory_undeclared, pointing at cloudfall inventory show; greenfield joins this path when cloudfall init emits a plain inventory (the plan's Notes)
    • Answer from the project's rendered inventory. Works today for greenfield users, but adds a second code path the plan wants to remove
  8. Unknown host and patterns

    • Recommended: an unknown host exits NOT_FOUND (inventory_host_unknown); a host pattern such as web-* is a usage error. One host per call
    • Accept a pattern and answer every matching host. Handy, but the output grows without bound
  9. Agent access

    • Recommended: mcp serve --repository serves it as the read-only tool get_host; not on a project
    • CLI only for now

🤖 Generated with Claude Code

@shipmill-romamo

Copy link
Copy Markdown
Contributor Author

@romamo Decision needed: approve spec 028 (cloudfall get host on a team's Ansible repository, W-4 of the plan #188) with every recommendation in its "Decisions for you"?
CI on 81befb2: 3 checks green

  1. Take every recommendation (recommended): the spec merges as written and its build issues are filed under cloudfall get host returns a host's merged variables on a team's repository, with the file that sets each winning value #620. Users get a read-only get host that names the file and precedence level setting each winning value, says "unknown file" rather than guessing, shows vaulted values as {"vaulted": true}, and is served as the get_host tool on mcp serve --repository. It adds a command and an output and changes nothing existing users rely on
  2. Change one or more items (name them and the option you want): the spec is revised in this PR and asked again, so the build waits one more round
  3. Not now: the spec PR stays open and cloudfall get host returns a host's merged variables on a team's repository, with the file that sets each winning value #620 is postponed; get host stays unbuilt, so requirement 14 stays Partial

Reply here with a number or your own answer; shipmill takes this up on the tick after your reply.

@shipmill-romamo shipmill-romamo Bot added the needs-decision A shipmill session asked a question here; waits for a reply label Nov 26, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-decision A shipmill session asked a question here; waits for a reply

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants